﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace Vehicle.Web.Pages.Expense
{
    /// <summary>
    /// Copyright (C) M-Tear团队
    /// 文 件 名：Expense_View.aspx.cs
    /// 版    本：v1.00.0000
    /// 创建标识：2009-09-02   Created by 杨光远 V1.00.0000
    /// 功能说明：运输费用查看页面类
    /// 注意事项：无
    /// 
    /// 更新记录：
    /// 
    /// </summary>
    public partial class Expense_View : System.Web.UI.Page
    {
        #region---基本变量实例化---
        Vehicle.BLL.Expense b_Expense = new Vehicle.BLL.Expense();
        BLL.Log b_Log = new Vehicle.BLL.Log();
        Vehicle.Model.ExpenseInfo m_ExpenseInfo = new Vehicle.Model.ExpenseInfo();
        #endregion

        #region---基本方法---
        /// <summary>
        /// 页面加载绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ExpenseDataBind();
            }
        }
        #region --- 费用信息绑定---
        /// <summary>
        /// 费用信息绑定
        /// </summary>
        public void ExpenseDataBind()
        {
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {

                DataTable dt = b_Expense.GetModel(new Vehicle.Model.ComponentsInfo("Expense", "E_ID", Request.QueryString["id"].ToString(), "E_ID"));//绑定费用ID
                if (dt.Rows.Count > 0)
                {
                    try
                    {
                        lab_C_ID.Text = b_Expense.GetModel(new Vehicle.Model.ComponentsInfo("Cargo", "C_ID", dt.Rows[0]["C_ID"].ToString(), "1", "1", "C_IsDelete", "1", "C_ID")).Rows[0]["C_Card"].ToString(); //绑定承运单编号               
                    }
                    catch
                    {
                        lab_C_ID.Text = "无";
                    }

                    try
                    {
                        lab_T_ID.Text = b_Expense.GetModel(new Vehicle.Model.ComponentsInfo("Task", "T_ID", dt.Rows[0]["T_ID"].ToString(), "1", "1", "T_IsDelete", "1", "T_ID")).Rows[0]["T_Num"].ToString();//绑定任务单编号
                    }
                    catch
                    {
                        lab_T_ID.Text = "无";
                    }
                    try
                    {
                        lab_M_ID.Text = b_Expense.GetModel(new Vehicle.Model.ComponentsInfo("Motorcade", "M_ID", dt.Rows[0]["M_ID"].ToString(), "1", "1", "M_IsDelete", "1", "M_ID")).Rows[0]["M_Name"].ToString();//绑定车对名称
                    }
                    catch
                    {
                        lab_M_ID.Text = "无";
                    }
                    try
                    {
                        lab_V_ID.Text = b_Expense.GetModel(new Vehicle.Model.ComponentsInfo("Vehicles", "V_ID", dt.Rows[0]["V_ID"].ToString(), "1", "1", "V_IsDelete", "1", "V_ID")).Rows[0]["V_LicenseNum"].ToString();//绑定车牌号
                    }
                    catch
                    {
                        lab_V_ID.Text = "无";
                    }
                    try
                    {
                        lab_P_ID.Text = b_Expense.GetModel(new Vehicle.Model.ComponentsInfo("Pilot", "P_ID", dt.Rows[0]["P_ID"].ToString(), "1", "1", "P_IsDelete", "1", "P_ID")).Rows[0]["P_Name"].ToString();//绑定驾驶员姓名
                    }
                    catch
                    {
                        lab_P_ID.Text = "无";
                    }
                    lab_E_All.Text = dt.Rows[0]["E_All"].ToString();//运输总费用
                    lab_E_personal.Text = dt.Rows[0]["E_personal"].ToString();//劳务费
                    lab_E_SCost.Text = dt.Rows[0]["E_SCost"].ToString();//保险费
                    lab_E_TCost.Text = dt.Rows[0]["E_TCost"].ToString();//运输费
                    lab_E_Incidental.Text = dt.Rows[0]["E_Incidental"].ToString();//杂费
                }
                else
                {
                    Common.MessageHelper.AlertBack("该记录已删除!");
                }
            }
            else
            {
                Common.MessageHelper.AlertBack("您的操作有误,请重新尝试!");
            }
        }
        #endregion


        #endregion
    }
}
